package net.xgs.rbac.entity.role;

import javax.persistence.*;
import java.util.Objects;

@Entity
@Table(name = "role_resource", schema = "rbac", catalog = "")
public class RoleResourceDto {
    private long id;
    private String name;
    private String type;
    private long parentId;
    private String backUrl;
    private String frontUrl;

    @Id
    @Column(name = "id")
    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    @Basic
    @Column(name = "name")
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Basic
    @Column(name = "type")
    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    @Basic
    @Column(name = "parent_id")
    public long getParentId() {
        return parentId;
    }

    public void setParentId(long parentId) {
        this.parentId = parentId;
    }

    @Basic
    @Column(name = "back_url")
    public String getBackUrl() {
        return backUrl;
    }

    public void setBackUrl(String backUrl) {
        this.backUrl = backUrl;
    }

    @Basic
    @Column(name = "front_url")
    public String getFrontUrl() {
        return frontUrl;
    }

    public void setFrontUrl(String frontUrl) {
        this.frontUrl = frontUrl;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        RoleResourceDto that = (RoleResourceDto) o;
        return id == that.id &&
                parentId == that.parentId &&
                Objects.equals(name, that.name) &&
                Objects.equals(type, that.type) &&
                Objects.equals(backUrl, that.backUrl) &&
                Objects.equals(frontUrl, that.frontUrl);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, name, type, parentId, backUrl, frontUrl);
    }
}
